package com.file.system.entity.system;


import com.file.system.entity.basic.WebBasic;
import com.file.system.plugin.validated.SQLInjectionValidation;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.*;
import javax.validation.groups.Default;
import java.io.Serializable;


/**
 * 字典值
 *
 * @author jch
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class WebDictionaryVal extends WebBasic implements Serializable {

    private static final long serialVersionUID = 1L;


    //新增
    public interface add extends Default {
    }

    //修改
    public interface update extends Default {
    }

    /**
     * 主键
     *
     * @mock
     */
    @NotNull(groups = {update.class}, message = "主键不能为空")
    @Min(value = 1, message = "id长度最小1")
    private Long id;
    /**
     * 父级id
     *
     * @mock
     */
    @Min(value = 1, message = "父级id最小1")
    private Long pid;
    /**
     * 名称
     *
     * @mock
     */
    @NotEmpty(groups = {update.class, add.class}, message = "名称不能为空")
    @Size(min = 0, max = 50, message = "名称长度1-50")
    @SQLInjectionValidation(fieldName = "名称")
    private String name;
    /**
     * 值
     *
     * @mock
     */
    @NotEmpty(groups = {update.class, add.class}, message = "值不能为空")
    @Size(min = 1, max = 50, message = "值长度1-50")
    @SQLInjectionValidation(fieldName = "值")
    private String val;
    /**
     * 所属字典
     *
     * @mock
     */
    @NotNull(groups = {add.class, update.class}, message = "所属字典不能为空")
    @Min(value = 1, message = "所属字典最小1")
    private Long fkDictionaryId;
    /**
     * 排序
     *
     * @mock
     */
    @NotNull(groups = {add.class, update.class}, message = "排序不能为空")
    @Min(value = 1, message = "排序最小1")
    @Max(value = 2000, message = "排序最大2000")
    private Integer sort;
    /**
     * 备注
     */
    private String description;
    /**
     * 是否为文件夹
     */
    private boolean isLeaf = false;
}
